package com.example.administrator.xxnapp.bean;

import android.util.Log;

import com.example.administrator.xxnapp.fragment.tucao.IModelTuCao;
import com.example.administrator.xxnapp.http.HttpUrl;
import com.example.administrator.xxnapp.tucao.IModelSendTuCao;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.request.GetRequest;
import com.lzy.okgo.request.PostRequest;

import java.io.Serializable;
import java.util.List;

/**
 * Created by Went_Gone on 2018/4/28.
 */

public class TuCaoBean implements Serializable,IModelTuCao,IModelSendTuCao{
    private static final String TAG = "TuCaoBean";

    /**
     * contentString : 王套路男神与小仙女
     * createDate : 1524900378548
     * id : 1
     * userId : 1
     * userName : 王套路
     * praise：1
     */

    private String contentString;
    private long createDate;
    private int id;
    private int userId;
    private String userName;
    private int praise;
    private String headImage;
    private List<ImageBean> imageList;
    private List<CommentListBean> commentList;


    public String getContentString() {
        return contentString;
    }

    public void setContentString(String contentString) {
        this.contentString = contentString;
    }

    public long getCreateDate() {
        return createDate;
    }

    public void setCreateDate(long createDate) {
        this.createDate = createDate;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public int getPraise() {
        return praise;
    }

    public void setPraise(int praise) {
        this.praise = praise;
    }

    public String getHeadImage() {
        return headImage;
    }

    public void setHeadImage(String headImage) {
        this.headImage = headImage;
    }

    @Override
    public GetRequest<String> getTuCao(int page, int pageSize, int userId) {
        return OkGo.<String>get(HttpUrl.GET_TUCAO_URL+"?page="+page+"_"+pageSize+"&userId="+userId);
    }

    @Override
    public GetRequest<String> praise(int userId, int tucaoId, int praise) {
        return OkGo.<String>get(HttpUrl.GET_PRAISE_URL+"?tucaoId="+tucaoId+"&isPraise="+praise);
    }

    @Override
    public PostRequest<String> comment(CommentListBean bean) {
        return OkGo.<String>post(HttpUrl.POST_COMMENT_URL)
                .upJson(new Gson().toJson(bean));
    }

    @Override
    public PostRequest<String> sendTuCao(TuCaoBean bean) {
        String json = new Gson().toJson(bean).toString();
        Log.e(TAG, "sendTuCao: "+json );
        return OkGo.<String>post(HttpUrl.POST_SEND_TUCAO_URL)
                .upJson(json);
    }

    public List<ImageBean> getImageList() {
        return imageList;
    }

    public void setImageList(List<ImageBean> imageList) {
        this.imageList = imageList;
    }

    public List<CommentListBean> getCommentList() {
        return commentList;
    }

    public void setCommentList(List<CommentListBean> commentList) {
        this.commentList = commentList;
    }
}
